/**
 * @file SdpOptions.h
 * @author Derek Liu (yjkhtddx@sina.com)
 * @brief
 * @version 0.1
 * @date 2024-1-13
 *
 * @copyright Copyright Sci-Tech Laboratories (c) 2024
 *
 */

// #pragma once
#ifndef __SdpOptions_h__
#define __SdpOptions_h__

#include <string>

using namespace std;

namespace STL
{
    typedef enum GB_SDP_Command_e
    {
        GB_SDP_Command_None,
        GB_SDP_Command_Play, // 默认
        GB_SDP_Command_Playback,
        GB_SDP_Command_Download,
        GB_SDP_Command_Talk
    } GB_SDP_Command;

    typedef enum GB_SDP_Proto_e
    {
        GB_SDP_Proto_None,
        GB_SDP_Proto_UDP, // 默认
        GB_SDP_Proto_TCP

    } GB_SDP_Proto;

    typedef enum GB_SDP_TcpType_e
    {
        GB_SDP_TcpType_None,
        GB_SDP_TcpType_Passive, // 默认
        GB_SDP_TcpType_Active

    } GB_SDP_TcpType;

    typedef enum GB_SDP_Mode_t
    {
        GB_SDP_Mode_None,
        GB_SDP_Mode_RecvOnly,
        GB_SDP_Mode_SendOnly
    } GB_SDP_Mode;

    // typedef enum GB_SDP_IpType_e
    // {
    //     GB_SDP_IpType_None,
    //     GB_SDP_IpType_IP4,
    //     GB_SDP_IpType_IP6
    // } GB_SDP_IpType;

    /**
     * @brief sdp生成参数
        # Session description:
        v=(protocol version)
        o=(owner/creator and session identifier)
        s=(sessionname)
        u=*(URI of description)
        c=*(connection information-not required if included in all media)
        # Time description:
        t=(timethesessionisactive)
        # Media description:
        m=(media name and transport address)
        c=*(connection information-optional if included at session-level)
        b=*(bandwidth information)
        a=*(zero or more media attribute lines)
        y=*(SSRC)
        f=*(媒体描述)
     */
    typedef struct GBSdpOptions_t
    {
        std::string deviceId = ""; // 用于生成ssrc,如果设置,生成ssrc时参考,如果为空,使用原逻辑,此规则不在标准中。
        // v=<version> => Protocol Version
        std::string v_version = "0";
        // o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address> => Origin
        std::string o_username = ""; // 必填
        std::string o_sess_id = "0";
        std::string o_sess_version = "0";
        std::string o_net_type = "IN";
        std::string o_addr_type = "IP4";
        std::string o_unicast_address = ""; // 必填
        // s=<session name> => Session Name
        GB_SDP_Command s_command = GB_SDP_Command_Play; // 必填
        // u=<uri>  // GB28181 u=<channle_id>:<type>
        std::string u_uri = ""; // Playback Download 使用
        // c=<nettype> <addrtype> <connection-address> => Connection Data
        std::string c_net_type = "IN";
        std::string c_addr_type = "IP4";
        std::string c_connection_address = ""; // 必填
        // t=<start-time> <stop-time> => Timing
        uint64_t t_start_time = 0;
        uint64_t t_stop_time = 0;
        // m=<media> <port> <proto> <fmt1> [fmt2] [fmt3] ... => Media Descriptions
        // a=<attribute> => Attributes
        std::string m_media = "video";
        uint16_t m_port = 0;                                // 必填
        GB_SDP_Proto m_proto = GB_SDP_Proto_UDP;            // 必填
        GB_SDP_TcpType a_tcp_type = GB_SDP_TcpType_Passive; // 默认TCP被动模式
        GB_SDP_Mode a_mode = GB_SDP_Mode_None;              // 必填
        std::string a_downloadspeed = "";                   // 下载请求使用
        std::string a_username = "";                        // 下载响应使用（非标准）
        std::string a_password = "";                        // 下载响应使用（非标准）
        std::string a_filesize = "";                        // 下载响应使用
        std::string a_stream = "";                          // 拉制定码流参数（非标准）：0,1，MAIN，SUB
        std::string a_streamMode = "";                      // 拉制定码流参数（非标准）：MAIN，SUB
        std::string a_streamprofile = "";                   // 拉制定码流参数（非标准）：a=streamprofile:码流类型（取值为整型，0为主码流，1为子码流，2为第三码流，以此类推）
        std::string a_streamnumber = "";                    // 拉制定码流参数（GB28181-2022纳入标准）：a=streamnumber:码流编号（取值为整型。0：主码流，1为子码流，2为第三码流，以此类推）
        // y=<ssrc>
        std::string y_ssrc = ""; // 必填
        // f=<media_description> 为空不加
        std::string f_media_description = "";
    } GBSdpOptions;
} // namespace STL
#endif //__SdpOptions_h__